import { createRouter, createWebHistory } from "vue-router";

// import component from "element-plus/es/components/tree-select/src/tree-select-option.mjs";

const routes = [
  {
    path: "/login",
    name: "Login",
    component: () =>
      import("@/views/Login.vue"),
  },
  {
    path: "/register",
    name: "Register",
    component: () =>
      import("@/views/Register.vue"),
  },
  {
    path: "/forgetpwd",
    name: "ChangePassword",
    component: () =>
      import( "@/views/ChangePassword.vue"),
  },
  {
    path: "/manage",
    redirect: "/home" // luofen:当访问manage路径时，重定向到/home，
  },
  {
    path: "/home", // 设置/home为主页面路由
    component: ()=>import('@/views/Home.vue'),
    children: [
      {
        // lcf：个人用户中心
        path: '/user/profile',
        component: () => import('@/views/user/UserProfile.vue')
      },
      {
        path: '/user/avatar',
        component: () => import('@/views/user/UserAvatar.vue')
      },
      {
        path: '/user/password',
        component: () => import('@/views/user/UserPassword.vue')
      },
      // 改动了路由，做了重定向，需要放的同学可以把自己的路径加上，之后在Home.vue加上自己想显示的路径就可以了
      // 商品管理区域
      {
        path: "/category",
        name: "Category",
        component: () =>
          import(/* webpackChunkName: "about" */ "@/views/Category.vue"),
      },
      // 用户管理
      // 权限管理
      // 订单管理
      // 数据统计
   
    ]
  },
  {
    path: "/orderList/:order_admin",
    name: "OrderList",
    component: () =>
      import(/* webpackChunkName: "about" */ "@/views/order/OrderList.vue"),
  },
  {
    path: "/register",
    name: "Register",
    component: () =>
      import(/* webpackChunkName: "about" */ "@/views/Register.vue"),
  },

  {
    path: "/ReviewOrderList",
    name: "ReviewOrderList",
    component: () =>
      import(/* webpackChunkName: "about" */ "@/views/order/ReviewOrderList.vue"),
  },
  {
    path: "/ReviewOrder/:id",
    name: "ReviewOrder",
    component: () =>
      import(/* webpackChunkName: "about" */ "@/views/Order/ReviewOrder.vue"),
  },
  
  {
    path: "/Order/Add/:order_admin",
    name: "Order/Add",
    component: () =>
      import(/* webpackChunkName: "about" */ "@/views/order/AddOrder.vue"),
  }
  ,
  {
    path: "/Order/Detail/:id",
    name: "Order/Detail",
    component: () =>
      import(/* webpackChunkName: "about" */ "@/views/order/EditOrder.vue"),
  },
  {
    path: "/OrderShipped",
    name: "OrderShipped",
    component: () =>
      import(/* webpackChunkName: "about" */ "@/views/order/OrderShipped.vue"),
  },
  

  {
    path: "/category",
    name: "Category",
    component: () =>
      import(/* webpackChunkName: "about" */ "@/views/Category.vue"),
  },


];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

// 路由守卫
// router.beforeEach((to,from,next)=>{
//   // next:表示只有执行next()页面才会进行跳转
//   // 判断用户是否登录



// })



export default router;	